package com.engine.salary.mapper.siaccount;

import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

/**
 * @Author weaver_cl
 * @Date 2022/4/11
 * @Version V1.0
 **/
public interface InsuranceAccountDetailMapper {

    /**
     * 查询正常缴纳列表
     *
     * @param queryParam
     * @return
     */
    List<InsuranceAccountDetailPO> list(@Param("param") InsuranceAccountDetailParam queryParam);

    /**
     * 查询正常缴纳列表_非系统人员
     *
     * @param queryParam
     * @return
     */
    List<InsuranceAccountDetailPO> extList(@Param("param") InsuranceAccountDetailParam queryParam);

    /**
     * 通过id查询
     */
    InsuranceAccountDetailPO getById(@Param("id") Long id);

    /**
     * 根据账单月份获取所有员工
     *
     * @param time
     * @return
     */
    List<Long> selectAccountIds(@Param("time") String time, @Param("paymentOrganization") Long paymentOrganization);


    /**
     * 根据缴纳组织获取员工id
     *
     * @param paymentOrganization
     * @return
     */
    List<Long> selectEmpByPaymentOrg(@Param("paymentOrganization") Long paymentOrganization);

    /**
     * 根据id删除
     *
     * @param id
     */
    void deleteById(@Param("id") Long id);

    /**
     * 批量删除
     */
    void batchDelAccountDetails(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("paymentStatus") Integer paymentStatus);

    /**
     * 根据id批量删除
     */
    void batchDelAccountDetailsByIds(@Param("ids") Collection<Long> ids);

    /**
     * 批量保存
     *
     * @param accounts
     */
    void batchSaveAccountDetails(@Param("accounts") Collection<InsuranceAccountDetailPO> accounts);


    /**
     * 条件查询
     *
     * @param billMonth
     * @return
     */
    List<InsuranceAccountDetailPO> selectList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);

    List<InsuranceAccountDetailPO> queryList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("employeeIds") Collection<Long> employeeIds);

    /**
     * 查询正常缴纳数据
     * @param billMonth 账单月份
     * @param paymentOrganization 个税扣缴义务人
     * @param employeeId 人员id
     * @return
     */
    List<InsuranceAccountDetailPO> queryNormalList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("employeeId") Long employeeId);

    /**
     * 查询补缴数据
     * @param billMonth 账单月份
     * @param paymentOrganization 个税扣缴义务人
     * @param employeeId 人员id
     * @param supplementaryMonth 补缴月份
     * @return
     */
    List<InsuranceAccountDetailPO> querySupplementList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("employeeId") Long employeeId, @Param("supplementaryMonth") String supplementaryMonth);

    /**
     * 查询补缴数据
     * @param billMonth 账单月份
     * @param paymentOrganization 个税扣缴义务人
     * @return
     */
    List<InsuranceAccountDetailPO> querySupplementListByBillMonth(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);

    /**
     * 查询补差数据
     * @param billMonth 账单月份
     * @param paymentOrganization 个税扣缴义务人
     * @return
     */
    List<InsuranceAccountDetailPO> queryBalanceListByBillMonth(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);

    /**
     * 查询正常缴纳数据
     * @param billMonth 账单月份
     * @param paymentOrganization 个税扣缴义务人
     * @return
     */
    List<InsuranceAccountDetailPO> queryNormalListByBillMonth(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
    /**
     * 根据账单月份删除
     *
     * @param billMonth
     */
    void batchDeleteNotFile(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);


    /**
     * 批量删除
     *
     * @param pos
     */
    void batchDelSupplementAccountDetails(@Param("pos") Collection<InsuranceAccountDetailPO> pos);


    /**
     * 根据员工id批量删除
     *
     * @param pos
     */
    void batchDelSupplementDetailsByIds(@Param("pos") Collection<SupplementAccountBaseParam> pos);


    void batchUnConfirmedInspectDetails(@Param("ids") Collection<Long> ids);


    void batchIgnoreInspectDetails(@Param("ids") Collection<Long> ids);


    List<InsuranceArchivesEmployeePO> changeList(@Param("userName") String userName);

    /**
     * 根据员工id和账单月份更新数据
     */
    void updateByEmployeeIdAndBillMonth(InsuranceAccountDetailPO po);

    List<InsuranceAccountDetailPO> listAll();

    int batchUpdate(@Param("collection") List<InsuranceAccountDetailPO> pos);

    /**
     * 根据id更新数据
     */
    void updateById(InsuranceAccountDetailPO po);


    /**
     * 删除退差数据(账单月份+退差月份+缴纳状态+人员id+个税扣缴义务人)
     */
    void deleteRecessionData(InsuranceAccountDetailPO po);

    /**
     * 获取数据(账单月份+缴纳状态+人员id+个税扣缴义务人)
     */
    InsuranceAccountDetailPO getOneByBpep(InsuranceAccountDetailPO po);

    /**
     * 获取补差数据(账单月份+人员id+个税扣缴义务人)
     */
    List<InsuranceAccountDetailPO> queryBalanceList(InsuranceAccountDetailPO po);

    /**
     * 根据id删除
     * @param ids
     */
    void deleteByIds(@Param("ids")List<Long> ids);

    void deleteByEmpIds(@Param("employeeIds")List<Long> deleteEmployeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
}
